<?php
//include("../security.php");
include_once("../inc/db.class.php");
include("../class/Product.class.php");
include("../inc/functions.php");
$product = new Product();
$product->name = security_on($_REQUEST['name']);
$product->title = security_on($_REQUEST['title']);
$product->category = security_on($_REQUEST['category']);
$product->description = security_on($_REQUEST['description']);

$product->color = security_on($_REQUEST['color']);
$product->size = security_on($_REQUEST['size']);
$product->price = security_on($_REQUEST['price']);
$product->discount = security_on($_REQUEST['discount']);
$product->status = security_on($_REQUEST['status']);
$product->show_this_product = security_on($_REQUEST['show-this']);
$product->path = security_on($_REQUEST['product_image_path']);

if($product->create_product()){
  $_SESSION['success'] = "Product ".$product->name." ".$product->title." has been added successfully.";
  header("location: ../product-registration.php");
}else{
    $_SESSION['error'] = "An error ocoured. Product ".$product->name." ".$product->title." cpould not added.";
  header("location: ../product-registration.php");
}
?>